<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<?php $this->load->view('common/head');?>
<style>
	#deliver_show li{list-style: none;}
	#deliver_show .order_title{margin:10px 0;}
	#deliver_show .order_title .f_l{color:#ff6600;margin-right:10px;}
	#deliver_show .order_title .f_r{color:#666666;}
	.deliver_tit{font-weight: 700;line-height:30px;border-bottom: 1px solid #ddd;margin-bottom: 10px;}
	.deliver_tit span{margin-right:10px;}
	.deliver_tit .pull-right{color: #ff6600;}
</style>


	<div class="main-container" id="main-container">
    <script type="text/javascript">
        $(function(){
		 	$.get("<?php echo site_url('api/deliver/get_deliver_info/'.$order_info['order_id']);?>", function(json){
		 		var result="";
		 		var data =JSON.parse(json);
		 		console.log(data);
                if(data){
                    if(data.status==1){
                    	//快递单号
                    	var noa = data.list.OrderCode;
                    	//物流单号
                    	var nob = data.list.LogisticCode;
                    	//是否签收
                    	var success = data.list.Success;
                    	//轨迹
                    	var lists = data.list.Traces;
                        lists = lists.reverse();
                    	result += '<div class="deliver_tit"><span>物流公司：'+data.msg+'</span><span>快递单号：'+noa+'</span></div>';
                    	result += '<div class="deliver_tit"><span>物流单号：'+nob+'</span>';
                    	if(success){
                    		result += '<span class="pull-right">已签收</span>';
                    	}
                    	result += '</div>';
                    	if(lists.length>0){
							for(i=0; i<lists.length; i++){
								result += '<li>';
								result += '<div class="order_title">'
								result += '<span class="f_l">'+lists[i].AcceptTime+'</span>';
								result += '<span class="f_r">'+lists[i].AcceptStation+'</span>';
								result += '</div>';
								result += '</li>';
							}
                    	}else{
                    		result += '<li>';
							result += '<div class="order_title">'
							result += '<span class="f_l">'+data.list.Reason+'</span>';
							result += '</div>';
							result += '</li>';
                    	}
                    }else{
                    	result += '<li>发生未知错误，请稍候查询</li>';
                    }
                }else{
                	result += '<li>发生未知错误，请稍候查询</li>';
                }             
				$('#deliver_show').append(result);
            });		   
		});
    </script>

    <?php $this->load->view('common/sidebar');?>
    <div class="main-content">
        <div class="main-content-inner">
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                    	<div id="deliver_show"></div>
                </div>
           </div>
       </div>
    </div>
<?php $this->load->view('common/footerjs');?>
</body>
</html>